package com.mt;

import com.mt.sort.AbstractSort;
import com.mt.sort.BubbleSort;
import com.mt.sort.InsertSort;
import com.mt.sort.SelectorSort;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @ClassNameTest
 * @Description
 * @Author
 * @Date2021/7/3 上午10:22
 * @Version V1.0
 **/
public class TestSort {
    int[] arr = {5, 4, 8, 1, 2, 3};

    //冒泡排序测试
    @Test
    public void bubbleTest() {
        AbstractSort sort = new BubbleSort();
        sort.sort(arr);
    }
    //选择排序测试
    @Test
    public void selectorTest() {
        AbstractSort sort = new SelectorSort();
        sort.sort(arr);
    }
    //插入排序测试
    @Test
    public void insertTest() {
        AbstractSort sort = new InsertSort();
        sort.sort(arr);
    }

    @Before
    public void before(){
        System.out.println("排序前");
        for (int i : arr) {
            System.out.print(i+",");
        }
    }
    @After
    public void after(){
        System.out.println("排序后");
        for (int i : arr) {
            System.out.print(i+",");
        }
    }
}
